// pages/co1lect/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabs:[
      {
        id:0,
        value:"商品收藏",
        isActive:true
      },
      {
        id:0,
        value:"品牌收藏",
        isActive:false
      },
      {
        id:0,
        value:"店铺收藏",
        isActive:false
      },
      {
        id:0,
        value:"浏览足迹",
        isActive:false
      },
    ],
    collect:[]
  },
  onShow:function(){
    let collect = wx.getStorageSync('collect')||[];
    this.setData({
      collect
    })
  },
  hanldeCollectItem(e){
      console.log(e);
      let {index}= e.detail
      //通过判断找到当前被点击的对象
      let {tabs} = this.data
      tabs.forEach((v,i)=>index===i?v.isActive=true:v.isActive=false)
      this.setData({
        tabs
      })
  }

})